<?php
if(isset($_POST["sub"])){
	
	$fp = fopen("../../../config/user_id.txt",'r');
	$id = fgets($fp);
	fclose($fp);
	//导入数据库配置文件
	require("../../../conn/conn.php");
	$name = $_POST["work_name"];
	$grade = $_POST["work_grade"];
	$subject = $_POST["work_subject"];
	$place = $_POST["work_place"];
	$price = $_POST["work_price"];
	$info = $_POST["work_info"];
	$start = $_POST["work_start_time"];
	$end = $_POST["work_end_time"];
	
	$sql_insert = "INSERT INTO `work_info` (`par_id`, `work_name`, `work_grade`, `work_subjects`, `work_place`
	, `work_price`, `work_info`, `work_start_time`, `work_end_time`)
	VALUES ('$id','$name', '$grade', '$subject', '$place', '$price', '$info', '$start', '$end')";
	
	if(mysqli_query($conn,$sql_insert)){
		echo"<script type="."\""."text/javascript"."\"".">"."window.alert"."("."\""."发布成功！"."\"".")".";"."</script>";
		echo"<script type="."\""."text/javascript"."\"".">"."window.location="."\""."../html/家长主页.php"."\""."</script>";
	}else{
		echo"<script type="."\""."text/javascript"."\"".">"."window.alert"."("."\""."输入了非法信息！"."\"".")".";"."</script>";
		echo"<script type="."\""."text/javascript"."\"".">"."window.location="."\""."../html/发布家教.php"."\""."</script>";
	}
	}
	